﻿@page "/toasts"
@inject IStringLocalizer<Toasts> Localizer
@inject ToastService ToastService
@inject IJSRuntime JSRuntime

<h3>@Localizer["ToastsTitle"]</h3>
<h4>@Localizer["ToastsSubTitle"]</h4>

<p>@Localizer["ToastsDescriptionTitle"]：</p>

<p class="code-label">@((MarkupString)Localizer["ToastsTips1"].Value)</p>
<Pre>@@inject ToastService ToastService</Pre>
<Pre>[Inject]
[NotNull]
private ToastService? ToastService { get; set; }
</Pre>
<p class="code-label">@((MarkupString)Localizer["ToastsTips2"].Value)</p>
<Pre>await ToastService.Success("Title", "Content", autoHide: true);</Pre>

<DemoBlock Title="@Localizer["ToastsNormalTitle"]"
           Introduction="@Localizer["ToastsNormalIntro"]"
           Name="Normal"
           Demo="typeof(Demos.Toasts.ToastsNormal)">
</DemoBlock>

<DemoBlock Title="@Localizer["ToastsCloseTitle"]"
           Introduction="@Localizer["ToastsCloseIntro"]"
           Name="Close"
           Demo="typeof(Demos.Toasts.ToastsClose)">
</DemoBlock>

<DemoBlock Title="@Localizer["ToastsShowHeaderTitle"]"
           Introduction="@Localizer["ToastsShowHeaderIntro"]"
           Name="ShowHeader"
           Demo="typeof(Demos.Toasts.ToastsShowHeader)">
</DemoBlock>

<DemoBlock Title="@Localizer["ToastsHeaderTemplateTitle"]"
           Introduction="@Localizer["ToastsHeaderTemplateIntro"]"
           Name="HeaderTemplate"
           Demo="typeof(Demos.Toasts.ToastsHeaderTemplate)">
</DemoBlock>

<DemoBlock Title="@Localizer["ToastsPositionTitle"]"
           Introduction="@Localizer["ToastsPositionIntro"]"
           Name="Position"
           Demo="typeof(Demos.Toasts.ToastsPosition)">
    @((MarkupString)Localizer["ToastsPositionDescription"].Value)
</DemoBlock>

<h4>@Localizer["ToastsPositionAttentionText"]</h4>

<p>@((MarkupString)Localizer["ToastsPositionTips"].Value)</p>

<ul class="ul-demo mb-3">
    <li><code>Success()</code></li>
    <li><code>Error()</code></li>
    <li><code>Information()</code></li>
    <li><code>Warning()</code></li>
</ul>

<p>@Localizer["ToastsPositionTips2"]：</p>

<Pre>ToastService?.Success("@Localizer["ToastsPositionSaved"]", "@Localizer["ToastsPositionAutoClose"]");</Pre>

<Pre>private void OnInfoClick()
{
    ToastService.Show(new ToastOption()
    {
        // @Localizer["ToastsPositionCategory"]
        Category = ToastCategory.Information,

        // @Localizer["ToastsPositionBoxTitle"]
        Title = "@Localizer["ToastsPositionNotification"]",

        // @Localizer["ToastsPositionContent"]
        Content = "@Localizer["ToastsPositionAddsNew"]"
    });
}</Pre>

<Tips>@((MarkupString)Localizer["ToastsPositionNote1"].Value)</Tips>

    <p>@((MarkupString)Localizer["ToastsPositionNote2"].Value)</p>

<Pre>"BootstrapBlazorOptions": {
    "ToastDelay": 4000,
    "MessageDelay": 4000,
    "SwalDelay": 4000
}</Pre>

<p>@((MarkupString)Localizer["ToastsPositionConfigured"].Value)</p>

<Pre>public void ConfigureServices(IServiceCollection services)
{
    // @Localizer["ToastsPositionDisappearance"]
    services.Configure&lt;BootstrapBlazorOptions&gt;(options =>
    {
        options.ToastDelay = 4000;
    });
}
</Pre>

<div class="mb-3">@((MarkupString)Localizer["ToastsPositionServerSide"].Value)</div>

<Pre>public void ConfigureServices(IServiceCollection services)
{
    // @Localizer["ToastsPositionAddComponent"]
    services.AddBootstrapBlazor(options =>
    {
        // @Localizer["ToastsPositionAutomaticDisappearance"]
        options.ToastDelay = 4000;
    });
}</Pre>

<AttributeTable Items="@GetAttributes()" />
